﻿/******************************************************************************
* File description: BoxChromatogramCollectSettings.qml
* Function: 能谱图绘制
* Current Version: 1.0.0
* Author: JNN
* Date: 2025-07-01
*  -----
*  Copyright by 博坤生物 .
 *****************************************************************************/
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12
import "../components/"
Rectangle {

    id: root


    property int showDetails: 0     // 0缩略图 1完整图

    color: Qt.rgba(233/255, 230/255, 224/255, 1)

    function refreshChartData(){
        chart.refreshData()
        if(showDetails === 1){
            chart.resetRange()
        }
    }

    onVisibleChanged: {
        if(showDetails === 1){      // 将在完整图中的缩放同步至缩略图
            chart.resetRange()
        }

    }onShowDetailsChanged: {
        chart.resetRange()
    }

    function initRange(){
        chart.initRange()
    }

    CustomChart{
        id: chart
        maxY: 800
        color: Qt.rgba(233/255, 230/255, 224/255, 1)
        title: "能谱图"
        cChartInterface: CChromChart
        height: parent.height - (showDetails === 1 ? 40*dp : 20*dp)
        width: parent.width - (showDetails === 1 ? 40*dp : 20*dp)
        x: showDetails === 1 ? 20*dp : 10*dp
        y: showDetails === 1 ? 20*dp : 10*dp
        title_fontsize: showDetails === 1 ? config.fontsize_1 : config.fontsize
        showChartTitle: showDetails === 1
        showTitleBtn: showDetails === 1
        showScrollBar: showDetails === 1
        margin: 0
    }

}
